Skip to content

Resolve SSH config Include directives in host completion#212

Merged
lucieleblanc merged 3 commits into
mainfrom
oz-agent/APP-3506-resolve-ssh-include-directives
Apr 1, 2026
Merged

Resolve SSH config Include directives in host completion#212
lucieleblanc merged 3 commits into
mainfrom
oz-agent/APP-3506-resolve-ssh-include-directives

Conversation

@lucieleblanc
Copy link
Copy Markdown
Contributor

Summary

The SSH host generator was hardcoded to cat ~/.ssh/config, which only reads the main config file. Users with configs split across included files via Include directives (e.g. Include conf.d/*) got no host suggestions for hosts defined in those files.

Fixes: APP-3506
See: #4072, #5900, #3708

Changes

Replaced the cat ~/.ssh/config command in both the hosts and addresses generators with a command that:

  1. Uses awk to extract Include paths from ~/.ssh/config
  2. Resolves ~ to $HOME
  3. Treats relative paths as relative to ~/.ssh/ (per SSH spec)
  4. Lets the shell expand glob patterns in Include paths
  5. Reads all included files alongside the main config

The known_hosts generator is unchanged since ~/.ssh/known_hosts doesn't use Include directives.

Testing

  • All 11 existing tests pass, including all_command_specs_have_no_newlines (TMUX safety) and all_referenced_generators_exist.
  • Manually verified with mock SSH configs that both relative (conf.d/*) and absolute (/path/to/conf.d/*) Include paths resolve correctly.

Conversation: https://staging.warp.dev/conversation/c78432f4-e7f9-4799-a3be-fc2b53cac149
Run: https://oz.staging.warp.dev/runs/019d473b-6e27-7de1-8c6c-90d7629402cd

This PR was generated with Oz.

The SSH host generator was hardcoded to 'cat ~/.ssh/config', which missed
hosts defined in files referenced by Include directives. Users with configs
split across included files (e.g. 'Include conf.d/*') got no host suggestions
for those entries.

Replace the command with one that uses awk to extract Include paths from
~/.ssh/config, resolves ~ to $HOME, treats relative paths as relative to
~/.ssh/, and lets the shell expand glob patterns. The included files are
then read alongside the main config so all Host entries are available for
completion.

Fixes: APP-3506
See: GitHub #4072, #5900, #3708

Co-Authored-By: Oz <oz-agent@warp.dev>
@linear
Copy link
Copy Markdown

linear Bot commented Apr 1, 2026

APP-3506 Resolve SSH config Include directives in host completion

Spec + generator exist, but the SSH host generator is hardcoded to cat ~/.ssh/config (confirmed in command-signatures/src/generators/ssh.rs). It does NOT resolve Include directives, so users with configs split across included files (e.g. Include conf.d/*) get no host suggestions.

Fix: Change generator to use ssh -G '' 2>/dev/null or manually parse Include directives.

See GitHub #4072, #5900, #3708

Copy link
Copy Markdown
Contributor Author

lucieleblanc commented Apr 1, 2026

SSH Completions with Include Directive Resolution — Visual Verification

Test Setup

  • ~/.ssh/config contains an Include config.d/* directive and 2 hosts (main-server, dev-box)
  • ~/.ssh/config.d/work contains 2 hosts (work-vpn, staging-env)
  • ~/.ssh/config.d/personal contains 2 hosts (home-nas, cloud-vm)

Result

Typing ssh and pressing Tab triggers the completions dropdown showing all 6 hosts from both the main config and included config files:

image

All hosts are correctly resolved:

  1. cloud-vm — SSH Host (from included file config.d/personal)
  2. dev-box — SSH Host (from main config)
  3. home-nas — SSH Host (from included file config.d/personal)
  4. main-server — SSH Host (from main config)
  5. staging-env — SSH Host (from included file config.d/work)
  6. work-vpn — SSH Host (from included file config.d/work)

✅ The hosts generator correctly resolves SSH Include directives and shows completions from all included config files.

@lucieleblanc lucieleblanc marked this pull request as ready for review April 1, 2026 17:31
@lucieleblanc lucieleblanc merged commit 7616535 into main Apr 1, 2026
3 checks passed
@lucieleblanc lucieleblanc deleted the oz-agent/APP-3506-resolve-ssh-include-directives branch April 1, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants